<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateProjekteTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('projekte', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('name')->default('');
			$table->string('project_no')->nullable();
			$table->text('desc', 65535);
			$table->integer('status')->index('projekte_status');
			$table->float('budget', 10, 0)->default(0);
			$table->string('level')->default('A-All new');
			$table->integer('prioity')->default(1);
			$table->string('customer_name')->default('')->index('projekte_customer');
			$table->string('supplier')->nullable()->default('');
			$table->float('target_fob', 10, 0)->nullable();
			$table->string('target_fob_currency', 3)->nullable()->default('RMB');
			$table->integer('forecasted_annual_quantity_1')->nullable()->default(0);
			$table->integer('forecasted_annual_quantity_2')->nullable()->default(0);
			$table->integer('forecasted_annual_quantity_3')->nullable()->default(0);
			$table->integer('customer_leader')->nullable();
			$table->integer('supplier_leader')->nullable()->index('projekte_supplier_leader');
			$table->integer('project_leader')->nullable()->index('projekte_project_leader');
			$table->integer('engineer_leader')->nullable();
			$table->integer('quality_leader')->nullable();
			$table->dateTime('start_date');
			$table->dateTime('end_date')->nullable();
			$table->dateTime('real_end_date')->nullable();
			$table->boolean('valid')->default(1);
			$table->timestamps();
			$table->softDeletes();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('projekte');
	}

}
